import Axios from 'axios';
//写法一
// export const carousel = data => {
//   return {
//     type: 'CAROUSEL',
//     payload: data
//   };
// };

//写法二
export const carousel = function(data) {
  return {
    type: 'CAROUSEL',
    payload: data
  };
};
export function fetchImg() {
  return dispatch => {
    return Axios({
      url: 'http://localhost:3000/home',
      method: 'get'
    }).then(res => {
      dispatch(carousel(res.data));
    });
  };
}
